/*
 * Copyright 2010-2012 Susanta Tewari. <freecode4susant@users.sourceforge.net>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package genomemap.cef.command.listener;

import cef.command.Command;
import cef.command.listener.CommandOutputEvent;
import cef.command.listener.CommandOutputListener;
import cef.command.listener.CommandOutputListenerException;
import cef.command.listener.FigureEditorOutputComponent;
import genomemap.cef.command.DrawAlignmentMap_Cmd;

/**
 * @author Susanta Tewari
 * @since Sep 26, 2011
 */
public class DrawAlignmentMap_OC extends FigureEditorOutputComponent {

    /**
     * Output component figure is initialized with the alignment map panel obtained form the command
     * via the event.
     *
     * @param cmdEvent command output event from command {@code DrawAlignmentMap_Cmd}
     *
     * @throws CommandOutputListenerException not thrown
     */
    @Override
    public void initComponents(final CommandOutputEvent cmdEvent)
            throws CommandOutputListenerException {

        title = "Alignment Map";

        if (cmdEvent.getSource() instanceof DrawAlignmentMap_Cmd) {

            final DrawAlignmentMap_Cmd command = (DrawAlignmentMap_Cmd) cmdEvent.getSource();

            this.figure = command.getAlignmentMap();
        }
    }

    /**
     * Method description
     *
     *
     * @return description
     */
    @Override
    public Class<? extends Command> getTargetCommandClass() {
        return DrawAlignmentMap_Cmd.class;
    }

    /**
     * Method description
     *
     *
     * @return description
     */
    @Override
    public CommandOutputListener newInstance() {
        return new DrawAlignmentMap_OC();
    }
}
